
<%--
 *  File:   DistributortenderSummary.jsp
 *  Desc:	the Lend slip summary page
 *
 *  Date		         Author		      Changes
 *  2009-10-22	  Only Jin		  Created
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
  //init param
  String privilegeCode = "SFE01110";
  String strTableName = "v_distributortendersummary";
  String strModuleName = "COM";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc"%>
<%@ include file="/inc/OvalLocationDefault.inc"%>

<html>
<head>
<title>DistributortenderSummary</title>
<PageFlow:CheckPageFlow pageName="p_distributortenderSummary" />
<%
	String isNew = "";
	String isDefault = "";
	String paraIsDefault = "";
	//System.out.println("Trace \"isdefault\" ------- summary" + ((String)pageContext.getAttribute("isdefault")));
	if("Y".equals(((String)pageContext.getAttribute("isdefault")))||"Y".equals(request.getParameter("isdefault"))) {
		isDefault = "&isdefault=Y";
		paraIsDefault="Y";
	}else if("N".equals(((String)pageContext.getAttribute("isdefault")))||"Y".equals(request.getParameter("isdefault"))) {
		isDefault = "&isdefault=N";
		paraIsDefault="N";
	}
%>
<%@ include file="/inc/CatchError.inc"%>
<%@ include file="/inc/SumDiv.inc"%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet"
	href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript"
	src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript"
	src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript"><!--
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "DistributortenderSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
function page_new()
{
	<%isNew = "&isNew=Y";%>
	//self.location.href='DistributortenderEdit.jsp?<%= OvalTools.randomURL() %>';
	location.href="DistributortenderFrm.jsp?<%= OvalTools.randomURL() %><%=JspHelper.filterNull(isDefault)%><%=JspHelper.filterNull(isNew)%>";
}

function page_edit(){
	var status = cform.status.value;
	if(status==112){
		alert("<%= message.getMessageDesc("CAN_NOT_BE_EDIT") %>");
		return;
	}
	var id = cform.distributortenderid.value;	
	//self.location.href='DistributortenderEdit.jsp?<%= OvalTools.randomURL() %>&distributortenderid='+id;

	<%isNew = "&isNew=N";%>
    
	editurl = "DistributortenderFrm.jsp?<%= OvalTools.randomURL() %><%=JspHelper.filterNull(isDefault)%>&distributortenderid=" + id + "&languagecode=" + "<%= strLanguageCode %><%=JspHelper.filterNull(isNew)%>";
	
    self.location.href = editurl;
}

function page_info()
{
    var id = cform.distributortenderid.value;
    self.location.href="DistributortenderFrmInfo.jsp?<%= OvalTools.randomURL() %>&distributortenderid="+id;
}
function page_delete()
{
	var cform = document.cform;
	var id = cform.distributortenderid.value;
	var status = cform.status.value;

	if(isEmpty(id) || id == -1) return;
	if(status==111 || status==112)
	{
		alert("<%= message.getMessageDesc("CAN_NOT_BE_DEL") %>");
		return;
	}
	if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE") %>") )  return;
	cform.actionname.value="delete";
	isRunning = true;
    cform.submit();
}

function clickRow(id,status)
{
	cform.distributortenderid.value = id;
	cform.status.value = status;
}


function page_popwindow(){
  	if(popwindow!=null)
    	popwindow.close();
  	var strurl="<%=contextPath%>/masterdata/ogm/BusiAreaTreePop.jsp?<%= OvalTools.randomURL()%>&languagecode=<%=strLanguageCode%>"; 
  	var strStatus= "height=400,width=260,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
 	popwindow=window.open(strurl, "newwindow",strStatus);
}

function page_setBusinessArea(id,areaname,parentid){
  	cform.areaid.value=id;
  	cform.areaname.value=areaname;
}


function page_AreaAllWindow(){
	  var url = "<%=contextPath%>/zyl/masterdata/map/SelectAreaTree.jsp?"+"<%= OvalTools.randomURL() %>";
	  var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
	  if(popwindow!=null) popwindow.close();
	  popwindow = window.open(url,null,windowAttribute);
}

function setAreas(areaids,areanames,areacodes){
	document.cform.areaid.value = areaids;
	document.cform.areaname.value = areanames;
	//document.cform.businessareacode.value = areacodes;
} 

--></script>
</head>

<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher"><input
	type="hidden" name="pagename" value="p_distributortenderSummary"> 
	<input type="hidden" name="actionname"> <%--  page location   --%> 
	<input type="hidden" name="isdefault" value="<%= paraIsDefault %>">
	<%@ include file="/inc/PageLocation.inc"%>

		<table width="100%" cellspacing="0" border="0" cellpadding="0">
		  <tr> 
		    <td> 
		      <table width="100%" border="0" cellspacing="0">
		        <tr> 
		          <td class="summary_top" colspan="3" ></td>
		        </tr>
		        <tr>
		          <td>    
		            <table border="0" cellspacing="0">    
		            <%@ include file="/inc/SummarySearch.inc" %>  
		            </table>
		          </td>
		        </tr>
		      </table>
		    </td>
		  </tr>
		<tr>
		  <td>
		    <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
		      <tr class="deepblue-left">
		        <td class="title_center">&nbsp;</td>
		        <td class="title_center"><a href="javascript:page_summary('orderby', 'distributortendercode')"><%= label.getLabelName("L_DistributortenderCode") %></a></td>
		        <td class="title_center"           ><a href="javascript:page_summary('orderby', 'distributortendername')"><%= label.getLabelName("L_DistributortenderName") %></a></td>
		        <td class="title_center"           ><a href="javascript:page_summary('orderby', 'areaname')"><%= label.getLabelName("L_ReportProvince") %></a></td>
		        <td class="title_center"><a href="javascript:page_summary('orderby', 'valuename')"><%= label.getLabelName("L_Drugs") %></a></td>
		        <td class="title_center" ><%= label.getLabelName("L_ContactId") %></td>
		        <td class="title_center" ><a href="javascript:page_summary('orderby', 'createdate')"><%= label.getLabelName("L_CreateTime") %></a></td>
		        <td class="title_center" ><a href="javascript:page_summary('orderby', 'markname')"><%= label.getLabelName("L_CreateUserName") %></a></td>
		        <td class="title_center" ><a href="javascript:page_summary('orderby', 'status')"><%= label.getLabelName("L_Status") %></a></td>
		      </tr>
		
          <%
             Vector visitprocessSummary1 = (Vector)pageContext.getAttribute("totalsummary");
             if(visitprocessSummary1 == null)
             {
               visitprocessSummary1 = new Vector();
             }
             String strClassType = new String("");   
             Integer nDefaultId = null;             
             Integer nDefaultStatus = null;
             Integer nDefaultVersion = new Integer(-1);
             int i=0;
             String strChecked = "";
             boolean bHasChecked = false;
             String username1="";
          %>   
          <logic:iterate id="visitprocessSummary" collection="<%= visitprocessSummary1 %>">
          <%
            if(i%2 == 1)
            {
              strClassType = "td-listrom";
            }else{                    
              strClassType = "none";
            }
            if(!bHasChecked)
            {
              nDefaultId = (Integer)((HashMap)pageContext.getAttribute("visitprocessSummary")).get("distributortenderid");
              nDefaultStatus = (Integer)((HashMap)pageContext.getAttribute("visitprocessSummary")).get("status");   
              username1 = (String)((HashMap)pageContext.getAttribute("visitprocessSummary")).get("username");
              bHasChecked = true;
              strChecked = "Checked";
            }
            else
            {
              strChecked = "";
            }
            i++;
          %>
		      <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  onClick="radiotrue('distributortenderid<%=JspHelper.filterNull( i )%>');
			    javascript:clickRow('<oval:write name="visitprocessSummary" property="distributortenderid" />', 
			                        '<oval:write name="visitprocessSummary" property="status" />');"     
          class="<%=JspHelper.filterNull( strClassType )%>"> 
            <td> 
              <input <%=JspHelper.filterNull( strChecked )%> id="distributortenderid<%=JspHelper.filterNull( i )%>" type="radio" name="order" value="<oval:write name="visitprocessSummary" property="distributortenderid"/>" class="normalradio"/>
            </td>       
            <td class="hand"><a href="DistributortenderFrmInfo.jsp?<%= OvalTools.randomURL() %><%=JspHelper.filterNull(isDefault)%>&distributortenderid=<custom:write name="visitprocessSummary" property="distributortenderid"/>"><custom:write name="visitprocessSummary" property="distributortendercode" nbsp="true"/></a></td>
            <td><custom:write name ="visitprocessSummary" property="distributortendername" nbsp="true"/></td>
            <td><custom:write name="visitprocessSummary" property="areaname" nbsp="true"/></td>
            <td><custom:write name="visitprocessSummary" property="valuename" nbsp="true"/></td>
            <td>&nbsp;<custom:write name="visitprocessSummary" property="username" nbsp="true"/>
            	<custom:write name="visitprocessSummary" property="usergroupname" nbsp="true"/>
            </td>
            <td><custom:write name="visitprocessSummary" property="createdate" dataType="date" dataFormatName="dateformat" nbsp="true"/></td>
            <td><custom:write name="visitprocessSummary" property="markname" nbsp="true"/></td>
            <td><custom:write name="visitprocessSummary" property="statusname" nbsp="true"/></td>
            
          </tr>
          </logic:iterate> 

        <input type="hidden" name="distributortenderid" value="<%=JspHelper.filterNull( nDefaultId )%>">  
        <input type="hidden" name="status" value="<%=JspHelper.filterNull( nDefaultStatus )%>">  
           
        <%@ include file="/inc/SummaryAction.inc" %>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top" ></td>
        </tr>
			<tr>
				<td class='td_center'>
				<a onclick="page_new();"><custom:button type="1" label="L_New" imgsrc="new.gif" border="0" style="width:60" privilegeCode="MB-ZTB01"/></a>
				<%if(pageContext.getAttribute("totalsummary")!=null){%>
				<a onclick="page_edit();"><custom:button type="1" label="L_Edit" imgsrc="Modify.gif" border="0" style="width:60" privilegeCode="MB-ZTB02"/></a> 
				<a onclick="page_delete();"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60" privilegeCode="MB-ZTB03"/></a>
				<%} %>
				</td>
			</tr>
      </table>
    </td>
  </tr>

</table>
 </form>
</body>
</html>
